<?php

  session_start();
  include "config.php";
  include "ALorder.php";

  if(isset($_SESSION["user"]))
  {
    include "$header";
    include "$body";

?>

<div style="position:absolute; top:0px; left:1px; border:0;">
  <span class="prevPage">Enquiry On Outstanding Order:Search > </span>
  <span class="page">Orders:Search</span>
</div>

<?php

  include "$H_eooo";

  echo "Customer No. <b>".$_SESSION["customerID"]."</b><p>";

  unset($_SESSION["eooo_order_no"]);
  unset($_SESSION["eooo_order_date"]);
  unset($_SESSION["eooo_prod_no"]);

  if(isset($_POST["all"]))
  {
    echo "<SCRIPT language='Javascript'>";
    echo "  window.location.href = 'enquiryOnOutstandingOrder_2searchResults.php';";
    echo "</SCRIPT>";
  }
  else if(isset($_POST["submit"]))
  {
    if(validOrderSearchDetails($_POST["order_no"], $_POST["product_no"]))
    {
      $_SESSION["eooo_order_no"] = ltrim($_POST["order_no"]);
      $_SESSION["eooo_order_date"] = $_POST["order_year"]."-".$_POST["order_month"]."-".$_POST["order_day"];
      $_SESSION["eooo_prod_no"] = ltrim($_POST["product_no"]);

      echo "<SCRIPT language='Javascript'>";
      echo "  window.location.href = 'enquiryOnOutstandingOrder_2searchResults.php';";
      echo "</SCRIPT>";
    }
  }

?>

<br>
<p>
<form name="orderSearch" action="" method="post">
  <input name="all" type="submit" style="font-family:'Century Gothic'; font-size:12px; color:#000000; border:1px solid #000000; width:115px; background-color:#FFFFFF" value="View all orders">
  <p>
  <b>OR</b>
  <p>
  <table style="border:1px solid #000000" cellpadding="5" cellspacing="5">
    <tr>
      <td>
        <b>Order No.</b>
      </td>
      <td>
        <b>Date of Order</b>
      </td>
      <td>
        <b>Product No. Ordered</b>
      </td>
    </tr>
    <tr>
      <td>
        <input class="orderSearch" name="order_no" type="text" style="border:1px solid #000000; width:150px"/>
      </td>
      <td>
        <select class="orderSearch" name="order_day" style="font-family:'Century Gothic'; font-size:12px; width:50px">
          <option value ="01">1</option>
          <option value ="02">2</option>
          <option value ="03">3</option>
          <option value ="04">4</option>
          <option value ="05">5</option>
          <option value ="06">6</option>
          <option value ="07">7</option>
          <option value ="08">8</option>
          <option value ="09">9</option>
          <option value ="10">10</option>
          <option value ="11">11</option>
          <option value ="12">12</option>
          <option value ="13">13</option>
          <option value ="14">14</option>
          <option value ="15">15</option>
          <option value ="16">16</option>
          <option value ="17">17</option>
          <option value ="18">18</option>
          <option value ="19">19</option>
          <option value ="20">20</option>
          <option value ="21">21</option>
          <option value ="22">22</option>
          <option value ="23">23</option>
          <option value ="24">24</option>
          <option value ="25">25</option>
          <option value ="26">26</option>
          <option value ="27">27</option>
          <option value ="28">28</option>
          <option value ="29">29</option>
          <option value ="30">30</option>
          <option value ="31">31</option>
        </select>
        <select class="orderSearch" name="order_month" style="font-family:'Century Gothic'; font-size:12px; width:100px">
          <option value ="01">January</option>
          <option value ="02">February</option>
          <option value ="03">March</option>
          <option value ="04">April</option>
          <option value ="05">May</option>
          <option value ="06">June</option>
          <option value ="07">July</option>
          <option value ="08">August</option>
          <option value ="09">September</option>
          <option value ="10">October</option>
          <option value ="11">November</option>
          <option value ="12">December</option>
        </select>
        <select class="orderSearch" name="order_year" style="font-family:'Century Gothic'; font-size:12px; width:75px">
          <option value ="2000">2000</option>
          <option value ="2001">2001</option>
          <option value ="2002">2002</option>
          <option value ="2003">2003</option>
          <option value ="2004">2004</option>
          <option value ="2005">2005</option>
          <option value ="2006">2006</option>
          <option value ="2007">2007</option>
          <option value ="2008">2008</option>
          <option value ="2009">2009</option>
          <option value ="2010">2010</option>
        </select>
      </td>
      <td>
        <input class="orderSearch" name="product_no" type="text" style="border:1px solid #000000; width:150px"/>
      </td>
    </tr>
  </table>
  <p>
  <input name="submit" type="submit" style="font-family:'Century Gothic'; font-size:12px; color:#000000; border:1px solid #000000; width:70px; background-color:#FFFFFF" value="Search">
</form>
</BODY>

<?php

  include "$footer";

  }

?>